package thread;

import java.util.concurrent.locks.ReentrantLock;

/**
 * Created with IntelliJ IDEA
 * Description
 * User：chenshu
 * Date：2023-11-14
 * Time：22:58
 */
public class Demo3 {
    public static void main(String[] args) {
        ReentrantLock locker = new ReentrantLock(true);
        try {
            //locker.lock();
            boolean flag = locker.tryLock();
            //中间抛异常了，可能执行不到unlock
        } finally {
            locker.unlock();
        }
    }
}
